FROM registry.cn-hangzhou.aliyuncs.com/node/node:14-alpine

WORKDIR /app

COPY package*.json ./
RUN npm config set registry https://registry.npmmirror.com
RUN npm install
# 安装全局依赖
RUN npm install -g egg-scripts

# 创建启动脚本
RUN echo '#!/bin/sh\ncd /app\necho "Starting Insight backend..."\nnode app.js' > /app/start.sh && \
  chmod +x /app/start.sh

COPY . .

CMD ["/app/start.sh"]

EXPOSE 7001
